/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.playground.core.service.ruler;

import com.playground.core.entity.Player;
import com.playground.core.entity.boardgame.BoardGame;
import com.playground.core.entity.boardgame.Move;

/**
 *
 * @author Tiago Peres
 */
public interface BoardGameRuler extends GameRuler {
    /**
     * Executes the given move in the board. It verifies the movement
     * validity before any action is taken.
     * 
     * @param game the game to apply te rules
     * @param m the movement to be realized by the piece
     * @return true if the move was executed, false if it was not valid
     */
    boolean executeMove(BoardGame game, Move move);
    
    /**
     * Verifies if the move (m) is a valid.
     * 
     * @param game the game to apply te rules
     * @param move the move the piece would execute
     * @return true if the movement is allowed, false otherwise
     */
    boolean isMoveAllowed(BoardGame game, Move move);
    
    /**
     * Ends the current turn.
     * 
     * @param game the game to apply te rules
     */
    void endTurn(BoardGame game);
    
    /**
     * Ends the current turn.
     * 
     * @param game the game to apply te rules
     * @param move usefull when ending the turn depends on the move made
     */
    void endTurn(BoardGame game, Move move);
    
    /**
     * Counts the pieces from the specified player that are still in the board.
     * 
     * @param game the game to apply te rules
     * @param player
     * @return 
     */
    int countPiecesFromPlayer(BoardGame game, Player player);
}
